<!DOCTYPE html>
<html>
	<title>
		Sign Up
	</title>
	<body>
	<font color=black>
<center>
<head>
<script>
function validateform() {
	//alert("Hi");
    var x = document.forms["signup"]["firstname"].value;
    var patt1 = /[0-9]/g;
    var result = x.match(patt1);
    //alert(result);
    if (x==null || x=="") {
        alert("First name must be filled out");
        return false;
    }
    else if((!isNaN(x))){
    	alert("Firstname must be only letters and characters");
    	return false;
    }
    else if(result!=null)
    	{
    		alert("Firstname must be only letters and characters");
    		return false;
    	}
    
     var email = document.forms["signup"]["emailid"].value;
     if (email==null || email=="") {
        alert(" Emailid must be filled out");
        return false;
    }
    else
    {
    var atpos = email.indexOf("@");
    var dotpos = email.lastIndexOf(".");
    if (atpos<1 || dotpos<atpos+2 || dotpos+2<=x.length) {
        alert("Not a valid e-mail address");
        return false;
    }    
    }
    var password = document.forms["signup"]["password"].value;
     if (password==null || password=="") {
        alert(" Password field is compulsory");
        return false;
    }
    var password = document.forms["signup"]["password"].value;
    var confirmpassword=document.forms["signup"]["confirmpassword"].value;
    if(password!=confirmpassword)
    {
    	alert("Entered wrong password in confirm password field");
    	return false;
    }
    var aliasname=document.forms["signup"]["user"].value;
     if (aliasname==null || aliasname=="") {
        alert(" Aliasname must be filled out");
        return false;
    }
    }
</script>
</head>
</head>
<body>
<style> 
#myDIV
{
    padding-right: 170px;
    text-align: right;
	width:500px;
	background-image: url("static/images/HiRes.jpg");
	color:black;
	font-size: 20px;
	border: 2px solid;
	border-radius: 10px;
}
h1{
    padding-right: 90px;
}

</style>
<center>

	<div id="myDIV">
		<b><h1>Sign up<h1></h1></b>
		<form name="signup" action="login.php"method="POST" onsubmit=" return validateform()"><br>
		Firstname:<input type="text" name="firstname" width="250%"><br><br>
		Lastname:<input type="text" name="lastname"><br><br>
		Email:<input type="text"name="emailid"><br><br>
		Password:
		<span class="labelTip" title=""></span>
		<input type="password"name="password"><br><br>
		Confirm Password:<input type="password"name="confirmpassword"><br><br>
		Username:<input type="text"name="user"><br><br>

		<label>Profession:</label>
			<select name="Profession"  method="get">
  		
  				<option value="Student">Student</option>
  				<option value="Professional">Professional</option>
  				<option value="Retiredlecturer">Retired Lecturer</option>
  				<option value="Lecturer">Lecturer</option>
  				<option value="Others">Others</option>
			</select>
		<br><br>
		<input type="submit" value="SUBMIT" style="margin-right:70px;">


		<br><br>

		<p><a href="main.php" style="padding-right:70px;">Back to home</a></p>
	
	</form>
	</div>
</body>
</html>
